package GUI;

import java.io.IOException;
import java.net.SocketException;
import java.util.List;

import tcpEngine.TCPNetworkEngine;

public class ReceiveRunnable extends Thread
{
	private MainGUI gui;
	private TCPNetworkEngine server;
	public ReceiveRunnable(MainGUI gui, TCPNetworkEngine o){
		this.gui = gui;
		this.server = o;
	}

	@Override
	public void run()
	{
		List<Object> received;
		while(server.isRunning()){
			try {
				received = server.update();
			} catch (IOException e) {
				break;
			}
			for(Object object : received){
				gui.messageShow.append((String)object+"\n");
			}
		}

	}

}
